Skip to content

Astro adapter - #297

Draft
Yuangwang wants to merge 21 commits into
mainfrom
astro-adapter
Draft

Astro adapter#297
Yuangwang wants to merge 21 commits into
mainfrom
astro-adapter

Conversation

@Yuangwang

@Yuangwang Yuangwang commented Jan 22, 2025

Copy link
Copy Markdown
Collaborator

Adds support for Astro in Firebase App Hosting.

To use follow these instructions:

  1. Install the @apphosting/astro-adapter Astro adapter with the following command in your terminal:
    npx astro add @apphosting/astro-adapter
  2. Add the adapter with the standalone rendering mode to your astro.config.* file:
import { defineConfig } from 'astro/config';
import node from '@apphosting/astro-adapter';

export default defineConfig({
  output: 'server',
  adapter: node({
    mode: 'standalone',
  }),
});
  1. Push the changes to github and kickoff a new rollout

@schmetti-dev

Copy link
Copy Markdown

local images are not showing up. Is there something i need to change to get it working or is this a bug?

image
image

const outputBundle: OutputBundleConfig = {
version: "v1",
runConfig: {
runCommand: `node dist/server/entry.mjs`,

@jhuleatt jhuleatt Jul 18, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path needs to respect the outDir option in astro.config. I think that can be done with the { dir } argument that is passed into this astro:build:done callback

setAdapter(getAdapter(_options));
},
"astro:build:done": async () => {
await fs.mkdir("./.apphosting");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await fs.mkdir("./.apphosting");
await fs.mkdir("./.apphosting", {
// Don't throw if directory already exists. Important when debugging the build locally
recursive: true
});

https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsmkdirpath-options-callback:~:text=.%20Calling%20fs.mkdir()%20when%20path%20is%20a%20directory%20that%20exists%20results%20in%20an%20error%20only%20when%20recursive%20is%20false

leoortizz added 10 commits July 23, 2026 18:19
@astrojs/node@10 replaced the adapter `args` config with a
`virtual:astro-node:config` module, so the installed major now selects
the
mechanism: v10+ gets a vendored config plugin and `entrypointResolution:
"auto"`,
v9 keeps the existing `args` export. Astro 5 support is unchanged.

Also fixes two bugs that block repeat and multi-version use:
- `.apphosting` was created with a non-recursive mkdir, so any second
  build in
  the same directory failed with EEXIST.
- `frameworkVersion` came from `npm view astro version`, reporting the
  latest
  published release rather than the one installed. It now reads the
  installed
  package.json, which also drops a network call from the build.

Verified against real App Hosting deployments on Astro 5, 6 and 7: SSR
rendering, API routes and middleware all serve per-request.
Relocates @apphosting/astro-adapter to
packages/@apphosting/experimental/,
registering the new workspace glob and adding the directory to the CI
build
artifact paths. The community/ glob is dropped since adapter-astro was
its only
member. Pure rename, no source changes.
The move to packages/@apphosting/experimental/ updated the npm workspaces
glob but not lerna.json, so lerna managed 8 packages and skipped the astro
adapter entirely — `npm run build` never built it. The community/ glob is
replaced rather than added to, since that directory no longer exists.
@wiz-9635d3485b

wiz-9635d3485b Bot commented Aug 7, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 1 Medium 1 Low
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 1 Medium 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants